home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Development / Feelin021015 / Examples / 00.c < prev    next >
C/C++ Source or Header  |  2002-10-28  |  2KB  |  87 lines

  1. #include <stdio.h>
  2.  
  3. #include <clib/exec_protos.h>
  4. #include <clib/dos_protos.h>
  5. #include <clib/graphics_protos.h>
  6. #include <clib/feelin_protos.h>
  7.  
  8. #include <graphics/gfxmacros.h>
  9. #include <libraries/feelin.h>
  10.  
  11. struct FeelinBase *FeelinBase;
  12.  
  13. ///drawfunc
  14. void ASM SAVEDS drawfunc(REG_A0 struct FeelinRender *Render,REG_A2 struct FeelinRect *Region)
  15. {
  16.    UWORD x1,y1,x2,y2,x3;
  17.    ULONG ap,bp;
  18.    struct RastPort *rp;
  19.  
  20.    static UWORD pt[] = {0xFF00,0x7F80,0x3FC0,0x1FE0,
  21.                         0x0FF0,0x07F8,0x03FC,0x01FE,
  22.                         0x00FF,0x807F,0xC03F,0xE01F,
  23.                         0xF00F,0xF807,0xFC03,0xFE01};
  24.  
  25.    static UWORD zr[] = {0xFFFF,0xFFFF,0xFFFF,0xFFFF};
  26.  
  27.    x1 = Region->x1 ; x3 = Region->x2 ; x2 = (x3 - x1) / 3 + x1;
  28.    y1 = Region->y1 ; y2 = Region->y2 ; rp = Render->psRPort;
  29.  
  30.    ap = Render->pnPens[FV_Pen_Fill];
  31.    bp = Render->pnPens[FV_Pen_HalfShadow];
  32.  
  33.    _APen(bp);
  34.    _Boxf(x1,y1,x2,y2);
  35.  
  36.    SetAfPt(rp,pt,4);
  37.    _APen(ap);
  38.    _BPen(bp);
  39.    _Boxf(x2+1,y1,x3,y2);
  40.    SetAfPt(rp,zr,2);
  41. }
  42. //+
  43.  
  44. ///Main
  45. void main()
  46. {
  47.    APTR c,w;
  48.    static STRPTR font = "Garnet/16";
  49.    static char myback[16];
  50.  
  51.    sprintf(myback,"F:%lx\0",&drawfunc);
  52.  
  53.    if (FeelinBase = (struct FeelinBase *)OpenLibrary("feelin.library",3))
  54.    {
  55.       c = ClientObject,
  56.          Child, w = WindowObject, FA_Window_Title, "Feelin with C",
  57.             FA_Back, myback,
  58.  
  59.             Child, HGroup,
  60.                Child, TextObject, FA_Font,font, FA_Back,"c:FF0000", FA_AltBack,"c:FF8080", FA_Text,"Red",   InputRelease, End,
  61.                Child, TextObject, FA_Font,font, FA_Back,"c:00FF00", FA_AltBack,"c:80FF80", FA_Text,"Green", InputRelease, End,
  62.                Child, TextObject, FA_Font,font, FA_Back,"c:0000FF", FA_AltBack,"c:8080FF", FA_Text,"Blue",  InputRelease, End,
  63.             End,
  64.          End,
  65.       End;
  66.  
  67.       if (c)
  68.       {
  69.          F_Do(c,FM_Notify, FA_Client_Signal,0x1000, FV_Notify_Self, 2,FM_Client_ReturnID,FV_Client_Quit);
  70.          F_Do(w,FM_Notify, FA_Window_CloseRequest,TRUE, FV_Notify_Client, 2,FM_Client_ReturnID,FV_Client_Quit);
  71.  
  72.          F_Set(w,FA_Window_Open,TRUE);
  73.  
  74.          F_DoA(c,FM_Client_Run,NULL);
  75.  
  76.          F_DisposeObj(c);
  77.       }
  78.  
  79.       CloseLibrary((struct Library *)FeelinBase);
  80.    }
  81.    else
  82.    {
  83.       Printf("Unable to open feelin.library\n");
  84.    }
  85. }
  86. //+
  87.